<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>RVM : Experimental Guidelines</title>
        <link rel="stylesheet" href="styles/site.css" type="text/css" />
        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>

    <body>
        <div id="page">
            <div id="main">
                <div id="main-header" class="pageSectionHeader">
                    <h1 id="title-heading" class="pagetitle">
                                                <span id="title-text">
                            RVM : Experimental Guidelines
                        </span>
                    </h1>

                    <div class="page-metadata">
                        <p>This page last changed on Dec 20, 2011 by <font color="#0050B2">steveblackburn</font>.</p>
                    </div>
                </div>

                <div id="content" class="view">
                    <div id="main-content" class="wiki-content group">
                    <p>This section provides some tips on collecting performance numbers with Jikes RVM.</p><h2 id="ExperimentalGuidelines-WhichbootimageshouldIuse">Which boot image should I use?</h2><p>To make a long story short the best performing configuration of Jikes RVM will almost always be <code>production</code>. Unless you really know what you are doing, don't use any other configuration to do a performance evaluation of Jikes RVM.</p><p>Any boot image you use for performance evaluation must have the following characteristics for the results to be meaningful:</p><ul><li>config.assertions=none. Unless this is set, the runtime system and optimizing compiler will perform fairly extensive assertion checking. This introduces significant runtime overhead. By convention, a configuration with the Fast prefix disables assertion checking.</li><li>config.bootimage.compiler=opt. Unless this is set, the boot image will be compiled with the baseline compiler and virtual machine performance will be abysmal. Jikes RVM has been designed under the assumption that aggressive inlining and optimization will be applied to the VM source code.</li></ul><h2 id="ExperimentalGuidelines-Whatcommand-lineargumentsshouldIuse">What command-line arguments should I use?</h2><p>For best performance we recommend the following:</p><ul><li><code>-X:processors=all</code>: By default, Jikes™ RVM uses only one processor for garbage collection. Setting this option tells the garbage collection system to utilize all available processors.</li><li>Set the heap size generously. We typically set the heap size to at least half the physical memory on a machine.</li></ul><h2 id="ExperimentalGuidelines- CompilerReplay"> Compiler Replay</h2><p>The compiler-replay methodology is deterministic and eliminates memory allocation and mutator variations due to non-deterministic application of the adaptive compiler. We need this latter methodology because the non-determinism of the adaptive compilation system makes it a difficult platform for detailed performance studies. For example, we cannot determine if a variation is due to the system change being studied or just a different application of the adaptive compiler. The information we record and use are hot methods and blocks information. We also record dynamic call graph with calling frequency on each edge for inlining decisions.</p><p><em>Note that in December 2011, compiler replay was significantly improved.   The notes below apply to the post December 2011 version of replay.</em></p><p>Here is how to use it:</p><h4 id="ExperimentalGuidelines-Generateadvice">Generate advice.</h4><p>There are three kinds of advice used by the replay system, each is workload-specific (ie you should generate advice files for each benchmark):</p><ol><li><strong>Compilation advice</strong> (.ca file).   This advice records for every compiled method which compiler (base or opt) and if opt, at which optimization level it should be compiled.  Replay compilation will not work without a compilation advice file.</li><li><strong>Edge counts</strong> (.ec file).  This advice captures edge counts generated by the execution of baseline-compiled code.   Edge counts are used by the compiler to understand which edges in the control flow graph are hot.   At the time of writing, edge counts were measured as contributing about 2% to the bottom line in terms of performance (average of DaCapo, jvm98 and jbb)</li><li><strong>Dynamic callgraph</strong> (.dc file).  This advice captures the dynamic call graph, which allows the compiler to understand the frequency with which particular call chains occur.  This is particularly useful in guiding inlining decisions.  At the time of writing the call graph contributes about 8% to the bottom line in terms of performance.</li></ol><p>One way to gather advice is to execute the benchmark multiple times under controlled settings, producing profiles at each execution.   Then establish the fastest execution among the set of runs, and choose the profiles associated with that execution as the advice files.   A common methodology is to invoke each benchmark 20 times (ie take the best invocation from a set of 20 trials), and in each invocation, run 10 iterations of the benchmark (ie the advice will then capture the warmed-up, steady state of the benchmark). </p><p>When generating the advice, you will need to use the following command line arguments (typically use all six arguments, so that all three advice files are generated at each invocation):</p><h6 id="ExperimentalGuidelines-Foradaptivecompilationprofile" style="margin-left: 30.0px;">For adaptive compilation profile</h6><div class="panel" style="border-width: 1px;"><div class="panelContent">
<p>-X:<a href="http://aosenable_advice_generation=true" class="external-link" rel="nofollow">aos:enable_advice_generation=true</a> -X:<a href="http://aoscafo=my_compiler_advice_file" class="external-link" rel="nofollow">aos:cafo=my_compiler_advice_file.ca</a></p>
</div></div><h6 id="ExperimentalGuidelines-Foredgecountprofile" style="margin-left: 30.0px;">For edge count profile</h6><div class="panel" style="border-width: 1px;"><div class="panelContent">
<p>-X:<a href="http://baseprofile_edge_counters=true" class="external-link" rel="nofollow">base:profile_edge_counters=true</a> -X:<a href="http://baseprofile_edge_counter_file=my_edge_counter_file" class="external-link" rel="nofollow">base:profile_edge_counter_file=my_edge_counter_file.ec</a></p>
</div></div><h6 id="ExperimentalGuidelines-Fordynamiccallgraphprofile" style="margin-left: 30.0px;">For dynamic call graph profile</h6><div class="panel" style="border-width: 1px;"><div class="panelContent">
<p>-X:<a href="http://aosdcfo=my_dynamic_call_graph_file" class="external-link" rel="nofollow">aos:dcfo=my_dynamic_call_graph_file.dc</a> -X:<a href="http://aosfinal_report_level=2" class="external-link" rel="nofollow">aos:final_report_level=2</a><span class="Apple-style-span" style="line-height: 0.0px;white-space: normal;"> </span></p>
</div></div><h4 id="ExperimentalGuidelines-Executingwithadvice">Executing with advice.</h4><div><p>The basic model is simple.  At a nominated time in the execution of a program, all methods specified in the .ca advice file will be (re)compiled with the compiler and optimization level nominated in the advice file.  Broadly, there are two ways of initiating bulk compilation: a) by calling the method <code>org.jikesrvm.adaptive.recompilation.BulkCompile.compileAllMethods()</code> during execution, and b) by using the <code>-X:aos:enable_precompile=true</code> flag at the command line to trigger bulk compilation at boot time.  A standard methodology is to use a benchmark harness call back mechanism to call  <code>compileAllMethods() </code>at the end of the first iteration of the benchmark.   At the time of writing this gave performance roughly 2% faster than the 10th iteration of regular adaptive compilation.  Because precompilation occurs early, the compiler has less information about the classes, and in consequence the performance of precompilation is about 9% slower than the 10th iteration of adaptive compilation.</p><p style="margin-left: 30.0px;"><strong>For 'warmup' replay</strong> (where <code>org.jikesrvm.adaptive.recompilation.BulkCompile.compileAllMethods()</code> is called at the end of the first iteration):</p><div class="panel" style="border-width: 1px;"><div class="panelContent">
<p>-X:<a href="http://aosinitial_compiler=base" class="external-link" rel="nofollow">aos:initial_compiler=base</a> -X:<a href="http://aosenable_bulk_compile=true" class="external-link" rel="nofollow">aos:enable_bulk_compile=true</a> -X:<a href="http://aosenable_recompilation=false" class="external-link" rel="nofollow">aos:enable_recompilation=false</a> -X:<a rel="nofollow">aos:cafi=benchmark.ca</a> -X:<a rel="nofollow">vm:edgeCounterFile=benchmark.ec</a> -X:<a rel="nofollow">aos:dcfi=benchmark.dc</a></p>
</div></div><p style="margin-left: 30.0px;"><strong>For precompile replay</strong> (where bulk compilation occurs at boot time):</p><div class="panel" style="border-width: 1px;"><div class="panelContent">
<p>-X:<a href="http://aosinitial_compiler=base" style="text-decoration: underline;" class="external-link" rel="nofollow">aos:initial_compiler=base</a> -X:<a href="http://aosenable_precompile=true" class="external-link" rel="nofollow">aos:enable_precompile=true</a> -X:<a href="http://aosenable_recompilation=false" style="text-decoration: underline;" class="external-link" rel="nofollow">aos:enable_recompilation=false</a> -X:<a style="text-decoration: underline;" rel="nofollow">aos:cafi=benchmark.ca</a> -X:<a style="text-decoration: underline;" rel="nofollow">vm:edgeCounterFile=benchmark.ec</a> -X:<a style="text-decoration: underline;" rel="nofollow">aos:dcfi=benchmark.dc</a></p>
</div></div><h4 id="ExperimentalGuidelines-Verbosity">Verbosity.</h4><p>You can alter the verbosity of the replay behavior with the flag  <code>-X:<a href="http://aosenable_precompile=true" class="external-link" rel="nofollow">aos:<span style="color: rgb(0,0,0);">bulk_compilation_verbosity</span></a></code>, which by default (0) is silent, but will produce more information about the recompilation with values of 1 or 2. </p></div><h2 id="ExperimentalGuidelines-MeasuringGCperformance">Measuring GC performance</h2><p> MMTk includes a statistics subsystem and a harness mechanism for measuring its performance.  If you are using the DaCapo benchmarks, the MMTk harness can be invoked using the '-c MMTkCallback' command line option, but for other benchmarks you will need to invoke the harness by calling the static methods</p><div class="panel" style="border-width: 1px;"><div class="panelContent">
<p>org.mmtk.plan.Plan.harnessBegin()<br /> org.mmtk.plan.Plan.harnessEnd()</p>
</div></div><p>at the appropriate places.  Other command line switches that affect the collection of statistics are</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th class="confluenceTh"><p>Option</p></th><th class="confluenceTh"><p>Description</p></th></tr><tr><td class="confluenceTd"><p>-X:gc:printPhaseStats=true</p></td><td class="confluenceTd"><p>Print statistics for each mutator/gc phase during the run</p></td></tr><tr><td class="confluenceTd"><p>-X:gc:xmlStats=true</p></td><td class="confluenceTd"><p>Print statistics in an XML format (as opposed to human-readable format)</p></td></tr><tr><td class="confluenceTd"><p>-X:gc:verbose</p></td><td class="confluenceTd"><p>This is incompatible with MMTk's statistics system.</p></td></tr><tr><td class="confluenceTd"><p>-X:gc:variableSizeHeap=false</p></td><td class="confluenceTd"><p>Disable dynamic resizing of the heap</p></td></tr></tbody></table></div><p>Unless you are specifically researching flexible heap sizes, it is best to run benchmarks in a fixed size heap, using a range of heap sizes to produce a curve that reflects the space-time tradeoff.  Using replay compilation and measuring the second iteration of a benchmark is a good way to produce results with low noise.</p><p>There is an active debate among memory management and VM researchers about how best to measure performance, and this section is not meant to dictate or advocate any particular position, simply to describe one particular methodology.</p><h2 id="ExperimentalGuidelines-JikesRVMisreallyslowWhatamIdoingwrong">Jikes RVM is really slow! What am I doing wrong?</h2><p>Perhaps you are not seeing stellar Jikes™ RVM performance. If Jikes RVM as described above is not competitive product JVMs, we recommend you test your installation with the DaCapo benchmarks. We expect Jikes RVM performance to be very close to Sun's HotSpot 1.5 server running the DaCapo benchmarks (see our <a href="http://jikesrvm.anu.edu.au/~dacapo/release/index.php" class="external-link" rel="nofollow">Nighlty DaCapo performance comparisions</a>page for the daily data).   Of course, running DaCapo well does not guarantee that Jikes RVM runs all codes well.</p><p>Some kinds of code will not run fast on Jikes RVM. Known issues include:</p><ol><li>Jikes RVM start-up may be slow compared to the some product JVMs.</li><li>Remember that the non-adaptive configurations (-X:aos:enable_recompilation=false -X:aos:initial_compiler=opt) opt-compile <em>every</em> method the first time it executes. With aggressive optimization levels, opt-compiling will severely slow down the first execution of each method. For many benchmarks, it is possible to test the quality of generated code by either running for several iterations and ignoring the first, or by building a warm-up period into the code. The SPEC benchmarks already use these strategies. The adaptive configuration does not have this problem; however, we cannot stipulate that the adaptive system will compete with the product on short-running codes of a few seconds.</li><li>Performance on tight loops may suffer. The Jikes RVM mechanism for safe points (thread preemption for garbage collection, on-stack-replacement, profiling, etc) relies on the insertion of a yield test on every back edge. This will hurt tight loops, including many simple microbenchmarks. We should someday alleviate this problem by strip-mining and hoisting the yield point out of hot loops, or implementing a safe point mechanism that does not require an explicit check.</li><li>The load balancing in the system is naive and unfair. This can hurt some styles of codes, including bulk-synchronous parallel programs.</li></ol><p>The Jikes RVM developers wish to ensure that Jikes RVM delivers competitive performance. If you can isolate reproducible performance problems, please let us know.</p>
                    </div>

                    
                 
                </div>             </div> 
            <div id="footer" style="background: url(http://docs.codehaus.org/images/border/border_bottom.gif) repeat-x;">
                <p><small>Document generated by Confluence on Feb 17, 2012 10:24</small></p>
            </div>
        </div>     </body>
</html>
